package com.itheima.App;

import com.itheima.dao.BookDao;
import com.itheima.Service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class app {
    public static void main(String[] args) {
        //1.创建IoC容器对象，加载spring核心配置文件
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        //2 从IOC容器中获取Bean对象(BookService对象)
        BookService bookService= (BookService)ctx.getBean("bookservice");
        BookDao bookdao = (BookDao) ctx.getBean("bookdao");
        //3 调用Bean对象(BookService对象)的方法
        bookService.save();
        bookdao.save();


    }
}
